# coding: utf-8
from django.db import models
from django.contrib.auth.models import User
from themes.models import Theme


class UserProfile( models.Model ):
    #Using User for ForeignKey
    user = models.ForeignKey( User, unique = True )
    nickname = models.CharField( max_length = 50, verbose_name = '昵称' )
    point = models.IntegerField( default = 0, verbose_name = '积分' )


class Role( models.Model ):
    TYPE_CHOICES = (
        ( 1, '普通用户' ),
        ( 2, '主题小组管理员' ),
        ( 3, 'Master' ),
    )

    type = models.IntegerField( choices = TYPE_CHOICES, verbose_name = '角色类型' )
    name = models.CharField( max_length = 20, verbose_name = '角色名称' )


class UserTheme( models.Model ):
    STATE_CHOICES = (
        ( 1, '申请中' ),
        ( 2, '未通过' ),
        ( 3, '已通过' ),
    )
    user = models.ForeignKey( User )
    theme = models.ForeignKey( Theme )
    role = models.ForeignKey( Role, verbose_name = 'mem_auth' )
    state = models.IntegerField( max_length = 1, choices = STATE_CHOICES )
